package com.iknow.task;

import com.iknow.http.HttpException;
import java.util.HashMap;

public class TaskParams
{
  private HashMap<String, Object> params;

  public TaskParams()
  {
    this.params = null;
    this.params = new HashMap();
  }

  public TaskParams(String paramString, Object paramObject)
  {
    put(paramString, paramObject);
  }

  public Object get(String paramString)
  {
    return this.params.get(paramString);
  }

  public boolean getBoolean(String paramString)
    throws HttpException
  {
    int i;
    Object localObject = get(paramString);
    if ((localObject.equals(Boolean.FALSE)) || ((localObject instanceof String) && (((String)localObject).equalsIgnoreCase("false"))))
      i = 0;
    while (true)
    {
      return i;
      if ((!(localObject.equals(Boolean.TRUE))) && (((!(localObject instanceof String)) || (!(((String)localObject).equalsIgnoreCase("true"))))))
        break;
      i = 1;
    }
    throw new HttpException(paramString + " is not a Boolean.");
  }

  public double getDouble(String paramString)
    throws HttpException
  {
    double d2;
    Object localObject = get(paramString);
    try
    {
      if (localObject instanceof Number)
      {
        d2 = ((Number)localObject).doubleValue();
      }
      else
      {
        double d1 = Double.parseDouble((String)localObject);
        d2 = d1;
      }
    }
    catch (Exception localException)
    {
      throw new HttpException(paramString + " is not a number.");
    }
    return d2;
  }

  public int getInt(String paramString)
    throws HttpException
  {
    int j;
    Object localObject = get(paramString);
    try
    {
      if (localObject instanceof Number)
      {
        j = ((Number)localObject).intValue();
      }
      else
      {
        int i = Integer.parseInt((String)localObject);
        j = i;
      }
    }
    catch (Exception localException)
    {
      throw new HttpException(paramString + " is not an int.");
    }
    return j;
  }

  public String getString(String paramString)
    throws HttpException
  {
    String str;
    Object localObject = get(paramString);
    if (localObject == null)
      str = null;
    while (true)
    {
      return str;
      str = localObject.toString();
    }
  }

  public boolean has(String paramString)
  {
    return this.params.containsKey(paramString);
  }

  public void put(String paramString, Object paramObject)
  {
    this.params.put(paramString, paramObject);
  }
}